/*
** pud_types.h for pud in mrcellophane/libpud
** 
** Made by solomon hykes
** Login   <torgau@gmail.com>
** 
** Started on  Mon May 16 19:10:02 2005 solomon hykes
** Last update Sun Jul 10 23:15:53 2005 solomon hykes
*/

#ifndef PUD_TYPES_H_
# define PUD_TYPES_H_

#include <stdlib.h>

#include <sys/types.h>

/*
** EXPORTED TYPES
*/

typedef enum
  {
    ret_ok = 0,
    ret_err = 1
  }	t_ret;


typedef enum
  {
    ev_stopped,
    ev_signaled,
    ev_exited,
    ev_trapped
  }	pud_event_what;

typedef union
{
  int		signal;
  int		exitcode;
  u_long	where;
}	pud_event_data;

typedef struct
{
  pud_event_what	what;
  pud_event_data	data;
  int			pass_signal; /* Signal to pass on */
}	pud_event;

/*
** OPAQUE TYPES
**
** Define these types as "void" to enforce their opacity.
**
** Pointer to these can be used as handles, but deferencing them will
** fail at compile-time.
**
** Private code casts this to "sys_pud_process".
*/

typedef enum
  {
    status_dead = 0,
    status_running = 1,
    status_stopped = 2,
    status_stepping = 3
  }	proc_status;

typedef struct
{
  pid_t		pid;
  proc_status	status;
  u_long	event_count;
}	pud_process;

/*
** maps
*/

struct s_pud_map
{
  u_long		start; /* Start address */
  u_long		size; /* Size (in bytes) */
  u_long		prot; /* Protections: mmap()'s PROT_X ored together */
  struct s_pud_map	*next;
};
typedef struct s_pud_map	pud_map;

#endif
